package com.dianrui.qiyouriding.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.dianrui.qiyouriding.R;
import com.dianrui.qiyouriding.interfaces.OnAskDialogCallBack;


public class WalletDialog {

    public static void createWalletDialog(final Context context, String title, final OnAskDialogCallBack onAskDialogCallBack) {
        final Dialog dialog = new Dialog(context, R.style.RcDialog);
        View view = LayoutInflater.from(context).inflate(R.layout.dlg_walletask, null);
        TextView contentDialogAsk = view.findViewById(R.id.content_dialog_ask);
        final TextView cancelDialogAsk =  view.findViewById(R.id.cancel_dialog_ask);
        final TextView yesDialogAsk = view.findViewById(R.id.yes_dialog_ask);
        contentDialogAsk.setText(title);
        contentDialogAsk.setTextColor(context.getResources().getColor(R.color.black));
        cancelDialogAsk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onAskDialogCallBack != null) {
                    onAskDialogCallBack.onCancel(dialog);
                }
            }
        });
        yesDialogAsk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onAskDialogCallBack != null) {
                    onAskDialogCallBack.onokey(dialog);
                }
            }
        });
        dialog.setContentView(view);
        dialog.setCanceledOnTouchOutside(false);
        dialog.show();

    }
}
